package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreArchiveTopic;
import com.fujitsu.nanjing.tieba.ibator.CoreArchiveTopicCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreArchiveTopicDAOImpl extends SqlMapClientDaoSupport implements CoreArchiveTopicDAO {

    public CoreArchiveTopicDAOImpl() {
        super();
    }

    public int countByExample(CoreArchiveTopicCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_archive_topic.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreArchiveTopicCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_archive_topic.deleteByExample", example);
        return rows;
    }

    public void insert(CoreArchiveTopic record) {
        getSqlMapClientTemplate().insert("core_archive_topic.insert", record);
    }

    public void insertSelective(CoreArchiveTopic record) {
        getSqlMapClientTemplate().insert("core_archive_topic.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreArchiveTopic> selectByExampleWithBLOBs(CoreArchiveTopicCriteria example) {
        List<CoreArchiveTopic> list = getSqlMapClientTemplate().queryForList("core_archive_topic.selectByExampleWithBLOBs", example);
        return list;
    }

    @SuppressWarnings("unchecked")
    public List<CoreArchiveTopic> selectByExampleWithoutBLOBs(CoreArchiveTopicCriteria example) {
        List<CoreArchiveTopic> list = getSqlMapClientTemplate().queryForList("core_archive_topic.selectByExample", example);
        return list;
    }

    public int updateByExampleSelective(CoreArchiveTopic record, CoreArchiveTopicCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_archive_topic.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExampleWithBLOBs(CoreArchiveTopic record, CoreArchiveTopicCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_archive_topic.updateByExampleWithBLOBs", parms);
        return rows;
    }

    public int updateByExampleWithoutBLOBs(CoreArchiveTopic record, CoreArchiveTopicCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_archive_topic.updateByExample", parms);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreArchiveTopicCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreArchiveTopicCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}